#include "wsys.h"
#include "xtime.h"
#include "str.h"
#include "fs.h"
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <map>
#include <iphlpapi.h>

namespace log4x
{
wsys::wsys()
{
}

wsys::~wsys()
{
}

int
wsys::hdd_info(hdd_info_s& info)
{
    return 0;
}

int
wsys::hdd_stat(const string& path, hdd_stat_s& stat)
{
#if 0
    string rootPath = path;
    fs::path_to_win(rootPath);

    memset(&stat, 0, sizeof(hdd_stat_s));
    BOOL bResult = FALSE;

    DWORD64 dwFreeBytes, dwFreeBytesToCaller, dwTotalBytes;
    bResult = GetDiskFreeSpaceEx(rootPath.c_str(),
                                 (PULARGE_INTEGER)&dwFreeBytesToCaller,
                                 (PULARGE_INTEGER)&dwTotalBytes,
                                 (PULARGE_INTEGER)&dwFreeBytes);
    if (!bResult)
    {
        return -1;
    }

    stat.total = dwTotalBytes / 1024;
    stat.used  = (dwTotalBytes - dwFreeBytes) / 1024;
    stat.free  = dwFreeBytes / 1024;

    stat.used_percent = stat.used / (double)stat.total * 100;
    stat.free_percent = stat.free / (double)stat.total * 100;

    char  lpVolumeNameBuffer[256]    = { 0 };
    DWORD nVolumeNameSize            = 256;
    char  lpFileSystemNameBuffer[24] = { 0 };
    DWORD nFileSystemNameSize        = 24;

    if (GetVolumeInformation(rootPath.c_str(),
                             lpVolumeNameBuffer,
                             nVolumeNameSize,
                             NULL,
                             NULL,
                             NULL,
                             lpFileSystemNameBuffer,
                             nFileSystemNameSize))
    {
        stat.format = lpFileSystemNameBuffer;
    }
#endif
    return 0;
}
}
